package com.ibiaoke.common.spring;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultBeanNameGenerator;

/**
 * 默认生成的Service Bean名称带有impl后缀
 *
 * 用插件去掉这些后缀
 *
 * Created by huhaichao on 2017/6/16.
 */
public class MyBeanNameGenerator extends DefaultBeanNameGenerator {
    @Override
    public String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry beanDefinitionRegistry) {
        String name = super.generateBeanName(beanDefinition, beanDefinitionRegistry);
        return name.replaceAll("Impl$","");
    }
}
